import jsCookie from "js-cookie";
import {
    ApiOutlined,
    BankOutlined,
    ContainerOutlined,
    DashboardOutlined,
    InsertRowBelowOutlined,
    MoneyCollectOutlined,
    PayCircleOutlined,
    ProfileOutlined,
    ShopOutlined,
    TeamOutlined,
    UserOutlined
} from "@ant-design/icons";

function addPrefix(item){
    if (item.children){
        return {
            ...item,
            children:item.children.map(ite=>{
                return addPrefix(ite)
            })
        }
    }
    if(item.path){
        return {
            ...item,
            path:"/ouyu/"+item.path,
            key:"/ouyu/"+item.path,
        }
    }
}
export default function getMenuList(){
    const role = JSON.parse(jsCookie.get("info")||"{}").role
    window.role = role;
    if (role === undefined){
        return []
    }
    let menuList=[]
    if(role === "admin"){
        menuList = [{
            label:"加盟商管理",
            path:"customer",
            icon:<BankOutlined />
        },{
            label:"首页滚动广告",
            path:"scrollAd",
            icon:<InsertRowBelowOutlined />
        },{
            label:"会员卡设置",
            path:"vipSetting",
            icon:<PayCircleOutlined />
        },{
            label:"会员列表",
            path:"members",
            icon:<UserOutlined />
        },{
            label:"茶艺师管理",
            path:"cysList",
            icon:<UserOutlined />
        },{
            label:"会员订单",
            path:"vipOrder",
            icon:<MoneyCollectOutlined />
        },{
            label:"设备管理",
            path:"devices",
            icon:<ApiOutlined />
        },{
            label:"提现账单",
            path:"cashOut",
            icon:<ContainerOutlined />
        },]
    }
    if (role === "店长"){
        menuList=[
            {
              label:"营业概览",
              path:"dashboard",
                icon:<DashboardOutlined />
            },
            {
                label:"店铺信息",
                path:"info",
                icon:<BankOutlined />
            },
            {
                label:"银行卡信息",
                path:"bankInfo",
                icon:<BankOutlined />
            },{
                label:"门店管理",
                icon:<ShopOutlined />,
                key:"md",
                children:[
                    {
                        label:"房间设置",
                        path:"teaRoom"
                    },{
                        label:"语音播报设置",
                        path:"broadcast"
                    },{
                        label:"团购设置",
                        path:"mtq"
                    },{
                        label:"微信通知",
                        path:"notify"
                    }
                ]
            },{
                label:"保洁管理",
                path:"operator",
                icon:<TeamOutlined />
            },{
                label:"订单列表",
                path:"orders",
                icon:<ProfileOutlined />
            },
            {
                label:"提现账单",
                path:"cashOut",
                icon:<ContainerOutlined />
            }
        ]
    }
    return menuList.map(addPrefix);
}